import { R } from '@/entity/R'
import { createAPI } from '@/utils/request'


// 登录
export async function login(username: string, password: string): Promise<R> {
  const { data } = await createAPI('/user/login', 'post', null, {
    username,
    password
  })
  return data
}

//注册
export async function register(username: string, password: string): Promise<R> {
  const { data } = await createAPI('/user/register', 'post', null, {
    username,
    password
  })
  return data
}

//获取用户信息  此方法需要设置请求头
export async function getUserInfo(): Promise<R> {
  const { data } = await createAPI('/user', 'get', null, null)
  return data
}




export async function smsMsg(username: string, password: string): Promise<R> {
  const { data } = await createAPI('/user/login', 'get', {
    username,
    password
  })
  return data
}